function d = tridi(a, b, c, d)
	% Intrari: a = subdiagonala
	% b = diagonala principala
	% c = supradiagonala
	% d = termeni liberi
	% Iesiri: d = necunoscute
	% eliminare element subdiagonal
	a = a(:);
	n = length(b);
	for i = 2 : n
		t = a(i) / b(i-1);
		b(i) = b(i) - t * c( i-1 );
		d(i) = d(i) - t * d( i-1 );
	endfor
	% rezolvarea sistemului bidiagonal
	d(n) = d(n) / b(n);
	for i = n-1 : 1 : 1
		d(i) = ( d(i) - c(i) * d(i+1) ) / b(i);
	endfor
endfunction
